package com.gjy.gateway.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-01-24 14:28:58
 */
@Configuration
public class GatewayCustomConfig {

    private static final Logger log = LoggerFactory.getLogger(GatewayCustomConfig.class);

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        log.info("config: {}", LocalDateTime.now());
        return builder.routes()
                .route("custom", r -> r.path("/test/*").uri("http://localhost:8999"))
                .build();
    }

}
